
package com.jf.cloud.search.constant;

import org.elasticsearch.search.sort.SortOrder;


/**
 * 装修商品排序
 * @author zz
 * @date 2023/01/30
 */
public enum EsRenovationProductSortEnum {

    /**
     * 上架时间升序
     */
    CREATE_TIME_ASC(0, "createTime", SortOrder.ASC),

    /**
     * 上架时间降序
     */
    CREATE_TIME_DESC(1, "createTime", SortOrder.DESC),

    /**
     * 销量倒序
     */
    SALE_NUM_DESC(2, "saleNum", SortOrder.DESC),

    /**
     * 销量正序
     */
    SALE_NUM_ASC(3, "saleNum", SortOrder.ASC),

    /**
     * 评论数量倒序
     */
    COMMENT_NUM_DESC(4, "commentNum", SortOrder.DESC),

    /**
     * 评论数量正序
     */
    COMMENT_NUM_ASC(5, "commentNum", SortOrder.ASC),
    ;

    private final Integer value;

    private final String param;

    private final SortOrder order;

    public Integer value() {
        return value;
    }

    EsRenovationProductSortEnum(Integer value, String param, SortOrder order) {
        this.value = value;
        this.param = param;
        this.order = order;
    }

    public String param() {
        return param;
    }

    public SortOrder order() {
        return order;
    }


//    public static Boolean isAsc(EsProductSortEnum esProductSortEnum) {
//        if (Objects.equals(esProductSortEnum.order(), Boolean.TRUE)) {
//            return Boolean.TRUE;
//        }
//        return Boolean.FALSE;
//    }
//    public static Boolean isDesc(EsProductSortEnum esProductSortEnum) {
//        if (Objects.equals(esProductSortEnum.order(), Boolean.FALSE)) {
//            return Boolean.TRUE;
//        }
//        return Boolean.FALSE;
//    }
}
